package com.hctrl.mybatis.metaObject.factory;

import org.apache.ibatis.reflection.DefaultReflectorFactory;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.ReflectorFactory;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;

/**
 * @author hanchao
 * @version 1.0
 * @date 2022/5/24 22:01
 */
public class MetaObjectFactory {

    private static ObjectFactory objectFactory = new DefaultObjectFactory();
    private static ObjectWrapperFactory objectWrapperFactory = new DefaultObjectWrapperFactory();
    private static ReflectorFactory reflectorFactory = new DefaultReflectorFactory();

    public static MetaObject getObjectInstance(Object object){
        MetaObject metaObject = MetaObject.forObject(object,objectFactory,objectWrapperFactory,reflectorFactory);
        return metaObject;
    }
}
